package com.stylefeng.guns.modular.exOrderExam.controller;

import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.ExOrderExam;
import com.stylefeng.guns.modular.exOrderExam.service.IExOrderExamService;

/**
 * 异常订单审核管理控制器
 *
 * @author fengshuonan
 * @Date 2018-10-12 14:30:21
 */
@Controller
@RequestMapping("/exOrderExam")
public class ExOrderExamController extends BaseController {

    private String PREFIX = "/exOrderExam/exOrderExam/";

    @Autowired
    private IExOrderExamService exOrderExamService;

    /**
     * 跳转到异常订单审核管理首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "exOrderExam.html";
    }

    /**
     * 跳转到添加异常订单审核管理
     */
    @RequestMapping("/exOrderExam_add")
    public String exOrderExamAdd() {
        return PREFIX + "exOrderExam_add.html";
    }

    /**
     * 跳转到修改异常订单审核管理
     */
    @RequestMapping("/exOrderExam_update/{exOrderExamId}")
    public String exOrderExamUpdate(@PathVariable Integer exOrderExamId, Model model) {
        ExOrderExam exOrderExam = exOrderExamService.selectById(exOrderExamId);
        model.addAttribute("item",exOrderExam);
        LogObjectHolder.me().set(exOrderExam);
        return PREFIX + "exOrderExam_edit.html";
    }

    /**
     * 获取异常订单审核管理列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return exOrderExamService.selectList(null);
    }

    /**
     * 新增异常订单审核管理
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(ExOrderExam exOrderExam) {
        exOrderExamService.insert(exOrderExam);
        return SUCCESS_TIP;
    }

    /**
     * 删除异常订单审核管理
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer exOrderExamId) {
        exOrderExamService.deleteById(exOrderExamId);
        return SUCCESS_TIP;
    }

    /**
     * 修改异常订单审核管理
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(ExOrderExam exOrderExam) {
        exOrderExamService.updateById(exOrderExam);
        return SUCCESS_TIP;
    }

    /**
     * 异常订单审核管理详情
     */
    @RequestMapping(value = "/detail/{exOrderExamId}")
    @ResponseBody
    public Object detail(@PathVariable("exOrderExamId") Integer exOrderExamId) {
        return exOrderExamService.selectById(exOrderExamId);
    }
}
